package com.ww.springboot.boot.configuration;

import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletResponse;

/**
 * 描述：
 *
 * @author wanwei
 * @since 2021-08-10 17:14
 */
@ControllerAdvice
public class ExceptionController {

    @ResponseBody
    @ExceptionHandler(Exception.class)
    public String globalException(HttpServletResponse response, Exception ex) {
        ex.printStackTrace();
        return ex.getMessage();
    }
}
